export default {
  created () {
    this.$mapManager.addEventListener('onloadMap1', this.initLayersAndMenus)
  },
  beforeDestroy () {
    this.$mapManager.removeEventListener('onloadMap1', this.initLayersAndMenus)
  },
  activated () {
    // this.$mapManager.addEventListener('clickFeature', this.clickFeature)
    this.firstLoaded = this.$options.data().firstLoaded
    if (this.$mapManager.getMapComponent()) {
      // 恢复到全貌
      setTimeout(() => {
        this.$mapManager.invoke('setZoom', 'quanmao')
      }, 200)
      this.initLayersAndMenus()
    }
  },
  deactivated () {
    // this.$mapManager.removeEventListener('clickFeature', this.clickFeature)
    this.$mapManager.invoke('setContextMenuMethod', () => [])
    this.$mapManager.invoke('closeDraw')
    this.$mapManager.invoke('clearLayers', ['graphicLayer', 'modifylayer'])
    this.clearAllLayers()
    this.$mapManager.invoke('closePopup')
  }
}
